package com.li.sssp.repository;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.li.sssp.entity.Employee;

public interface EmployeeRepository extends JpaRepository<Employee, Integer> {

	
	/**
	 * 根据LastName查询Employee
	 * @param lastName
	 * @return
	 */
	List<Employee> findByLastName(String lastName);
	
	
	// @Query("from Employee E where E.lastName like %?1")
	Page<Employee> findByLastNameLike(String lastName, Pageable pageable);

	/**
	 * 
	 * 
	 * @author guazi
	 * @param lastName
	 *            
	 * @param Pageable:
	 * @return "Page(Employee)"
	 * @version 0.1 2016-10-31
	 */
	@Query("from Employee E where E.lastName like %?1% order by E.id DESC")
	Page<Employee> QueryForLastName(String lastName, Pageable pageable);

	/**
	 *
	 * 
	 * @author guazi
	 * @param Pageable:
	 * @return "PageEmployee>"
	 * @version 0.1 2016-10-27
	 */
	Page<Employee> findAll(Pageable pageable);

}
